home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / sprinkle < prev    next >
Text File  |  1995-08-01  |  8KB  |  298 lines

  1. :
  2. # sprinkle - script to install a specified component of the Skunkware CD-ROM
  3. #            to the hard disk. This is necessary for some components which 
  4. #            need setuid/setgid bits since we are not currently permitting
  5. #            this (e.g. xmcd).
  6. #
  7. # Written 09-Mar-94 by rr@sco.com
  8. #
  9. # Usage: sprinkle [all comp1 comp2 ...]
  10. #
  11.  
  12. PROGRAMS="sockinfo u386mon atc memhog seyon xc warp vg \
  13.           ecu xmcd sfs lsof xlock pidentd"
  14.  
  15. usage() {
  16.     echo "Usage: sprinkle [-u] [-m mnt-pt] [-d inst-bin] [all comp1 comp2 ...]"
  17.     echo "\tWhere comp1, comp2, ... are one or more of"
  18.     echo "\tthe following components :"
  19.     echo "\t\tatc seyon xmcd memhog warp xc vg ecu"
  20.     echo "\t\tsockinfo u386mon sfs pidentd lsof xlock"
  21.     echo "\tAn argument of all indicates all of the above."
  22.     echo "\tThe -m argument is used to specify the absolute pathname "
  23.     echo "\tof the CD-ROM mount point. If it is omitted, you will be"
  24.     echo "\tprompted for a pathname (/usr/skunk is the default)."
  25.     echo "\tThe -d argument is used to specify the absolute pathname "
  26.     echo "\tof the installation bin. If it is omitted, you will be"
  27.     echo "\tprompted for a pathname (/usr/bin is the default)."
  28.     exit 1
  29. }
  30.  
  31. getyn() {
  32.     ans=
  33.     while [ "$ans" = "" ]
  34.     do
  35.         read ans
  36.         [ "$ans" = "Y" ] || [ "$ans" = "y" ] && {
  37.             ans=Y
  38.             break
  39.         }
  40.         [ "$ans" = "n" ] || [ "$ans" = "N" ] && {
  41.             ans=N
  42.             break
  43.         }
  44.         ans=
  45.         echo "\nPlease answer with a Y or N \c"
  46.     done
  47. }
  48.  
  49. setroot() {
  50.     cp $mntpt/bin/$1.real $inspt/$1
  51.     chown root $inspt/$1
  52.     chgrp root $inspt/$1
  53.     chmod 4711 $inspt/$1
  54. }
  55.  
  56. setuucp() {
  57.     cp $mntpt/bin/$1.real $inspt/$1
  58.     chown uucp $inspt/$1
  59.     chgrp uucp $inspt/$1
  60.     chmod 4711 $inspt/$1
  61. }
  62.  
  63. echo "Welcome to sprinkle, a tool for copying and setting permissions"
  64. echo "for portions of the SCO Skunkware CD-ROM."
  65. echo "This script is mainly useful for making one or more of the programs"
  66. echo "provided on the CD-ROM run as a setuid or setgid program."
  67.  
  68. fuid=`id`
  69. uid=`echo $fuid | awk ' { print $1 } '`
  70. [ "$uid" = "uid=0(root)" ] || {
  71.     echo "In order to execute sprinkle, you must have root privelege."
  72.     exit 1
  73. }
  74.  
  75. mntpt=
  76. inspt=
  77.  
  78. while case "$1" in
  79.     -u) usage
  80.         ;;
  81.     -m) [ "$2" ] || usage
  82.         mntpt=$2
  83.         shift
  84.         ;;
  85.     -d) [ "$2" ] || usage
  86.         inspt=$2
  87.         shift
  88.         ;;
  89.     "") break
  90.         ;;
  91.      *) break
  92.         ;;
  93.     esac
  94. do
  95.     shift
  96. done
  97.  
  98. if [ "$mntpt" = "" ]
  99. then
  100.     echo "\nPlease enter the absolute pathname of the CD-ROM mount point : [/usr/skunk] \c"
  101.     read mntpt
  102. fi
  103. [ "$mntpt" = "" ] && mntpt=/usr/skunk
  104.  
  105. if [ "$inspt" = "" ]
  106. then
  107.     echo "\nPlease enter the absolute pathname of the installation bin: [/usr/bin] \c"
  108.     read inspt
  109. fi
  110. [ "$inspt" = "" ] && inspt=/usr/bin
  111. [ -d $inspt ] || [ -h $inspt ] || mkdir -p $inspt
  112.  
  113. if [ $# = 0 ]
  114. then
  115.     echo "Please enter the Skunkware component to be installed : [all] \c"
  116.     read cmpnt
  117.     [ "$cmpnt" = "" ] && cmpnt=all
  118.     set -- $cmpnt
  119. else
  120.     cmpnt=$1
  121. fi
  122.  
  123. while case "$cmpnt" in
  124.     all)
  125.         $mntpt/bin/sprinkle -m $mntpt -d $inspt $PROGRAMS
  126.         ;;
  127.     sockinfo*)
  128.         echo "sprinkle: setting up sockinfo ..."
  129.         SOCKBIN=$inspt
  130.         cp $mntpt/bin/sockinfo.osr5 ${SOCKBIN}/sockinfo
  131.         chown root ${SOCKBIN}/sockinfo
  132.         chgrp mem ${SOCKBIN}/sockinfo
  133.         chmod 2511 ${SOCKBIN}/sockinfo
  134.         ;;
  135.     u386mon*)
  136.         echo "sprinkle: setting up u386mon ..."
  137.         U386BIN=$inspt
  138.         cp $mntpt/bin/u386mon.real ${U386BIN}/u386mon
  139.         chown root ${U386BIN}/u386mon
  140.         chgrp uucp ${U386BIN}/u386mon
  141.         chmod 4755 ${U386BIN}/u386mon
  142.         cp $mntpt/bin/nlsym.real ${U386BIN}/nlsym
  143.         chown root ${U386BIN}/nlsym
  144.         chgrp uucp ${U386BIN}/nlsym
  145.         chmod 4755 ${U386BIN}/nlsym
  146.         ${U386BIN}/nlsym > /dev/null 2>&1
  147.         ;;
  148.     atc*)
  149.         echo "sprinkle: setting up atc ..."
  150.         ATCDIR=/usr/games/lib/atc
  151.         export ATCDIR
  152.         cd $mntpt/games/lib/atc
  153.         [ -d $ATCDIR ] || mkdir -p $ATCDIR
  154.         find . -depth -print | cpio -pdm $ATCDIR > /dev/null 2>&1
  155.         chmod 666 $ATCDIR $ATCDIR/*
  156.         ;;
  157.     xmcd*) 
  158.         echo "sprinkle: setting up xmcd ..."
  159.         if [ -r $inspt/X11/xmcd ]
  160.         then
  161.          echo "A copy of xmcd already exists in $inspt/X11."
  162.          echo "If you would like to replace it with the Skunkware"
  163.          echo "xmcd package, remove the existing xmcd installation"
  164.          echo "and, as root, execute the commands :"
  165.          echo "\ncustom -p SKUNK:default -L SKUNK:xmcd -z /usr/skunk/cdmt/archives/TAPE"
  166.          echo "custom -p SKUNK:default -e SKUNK:xmcd "
  167.          echo "mkdev xmcd"
  168.         else
  169.          custom -p SKUNK:default -L SKUNK:xmcd -z /usr/skunk/cdmt/archives/TAPE
  170.          custom -p SKUNK:default -e SKUNK:xmcd
  171.          echo "In order to use xmcd, you must configure your CD-ROM drive"
  172.          echo "To do so, you can run the command 'mkdev xmcd'."
  173.          echo "Would you like to run mkdev xmcd at this time ? <Y/N> \c"
  174.          getyn
  175.          [ "$ans" = "Y" ] && mkdev xmcd
  176.         fi
  177.         ;;
  178.     xlock*)
  179.         echo "sprinkle: setting up xlock ..."
  180.         LOCKBIN=$inspt/X11
  181.         cp $mntpt/bin/X11/xlock.real ${LOCKBIN}/xlock
  182.         chown root ${LOCKBIN}/xlock
  183.         chgrp auth ${LOCKBIN}/xlock
  184.         chmod 2511 ${LOCKBIN}/xlock
  185.         ;;
  186.     pidentd*)
  187.         echo "sprinkle: setting up pidentd ..."
  188.         PIDENTBIN=/etc
  189.         SERVICES="ident 113/tcp auth tap"
  190.         INETCONF="ident  stream  tcp  nowait  nouser  /etc/in.identd in.identd"
  191.         cp $mntpt/etc/in.identd.real ${PIDENTBIN}/in.identd
  192.         chown root ${PIDENTBIN}/in.identd
  193.         chgrp mem ${PIDENTBIN}/in.identd
  194.         chmod 2511 ${PIDENTBIN}/in.identd
  195.         grep ident /etc/services /etc/inetd.conf > /dev/null && {
  196.             echo "\nApparently ident services have already been configured in"
  197.             echo "/etc/services and/or /etc/inetd.conf."
  198.             echo "\nPlease consult the file :\n"
  199.             echo "\t/usr/skunk/src/Tools/pidentd/pidentd-2.6.1/INSTALL"
  200.             echo "\nfor further instructions."
  201.             shift
  202.             cmpnt=$1
  203.             continue
  204.         }
  205.         echo "\nIn order to complete the installation of pidentd,"
  206.         echo "The lines :\n"
  207.         echo "\t$SERVICES"
  208.         echo "\nand\n"
  209.         echo "\t$INETCONF"
  210.         echo "\nneed to be added to the files"
  211.         echo "/etc/services and /etc/inetd.conf, respectively."
  212.     echo "\nWould you like to append these lines to these files at this time ? <Y/N>\c"
  213.         getyn
  214.         [ "$ans" = "Y" ] && {
  215.             echo $SERVICES >> /etc/services
  216.             echo $INETCONF >> /etc/inetd.conf
  217.             kill -1 `cat /etc/inetd.pid`
  218.         }
  219.         ;;
  220.     lsof*)
  221.         echo "sprinkle: setting up lsof ..."
  222.         LSOFBIN=$inspt
  223.         cp $mntpt/bin/lsof.real ${LSOFBIN}/lsof
  224.         chown root ${LSOFBIN}/lsof
  225.         chgrp mem ${LSOFBIN}/lsof
  226.         chmod 2511 ${LSOFBIN}/lsof
  227.         ;;
  228.     sfs*)
  229.         echo "sprinkle: setting up sfs ..."
  230.         [ -d /usr/games/lib/sfs ] || mkdir -p /usr/games/lib/sfs
  231.         [ -x /usr/games/lib/sfs/sfs ] || {
  232.             cp $mntpt/games/lib/sfs/* /usr/games/lib/sfs
  233.             chmod 777 /usr/games/lib/sfs
  234.         }
  235.         ;;
  236.     memhog|iohog|cpuhog)
  237.         echo "sprinkle: setting up memhog ..."
  238.         cp $mntpt/bin/memhog.real $inspt/memhog
  239.         chown bin $inspt/memhog
  240.         chgrp mem $inspt/memhog
  241.         chmod 2711 $inspt/memhog
  242.         cd $inspt
  243.         [ -f iohog ] || ln -s memhog iohog
  244.         [ -f cpuhog ] || ln -s memhog cpuhog
  245.         ;;
  246.     ecu*)
  247.         echo "sprinkle: setting up ecu ..."
  248.         [ -d /usr/lib/ecu ] || mkdir -p /usr/lib/ecu
  249.         cp $mntpt/lib/ecu/ecuungetty /usr/lib/ecu/ecuungetty
  250.         chown root /usr/lib/ecu/ecuungetty
  251.         chgrp root /usr/lib/ecu/ecuungetty
  252.         chmod 4711 /usr/lib/ecu/ecuungetty
  253.         ;;
  254.     vg*) 
  255.         echo "sprinkle: setting up vg ..."
  256.         setroot vg
  257.         ;;
  258.     warp*)
  259.         echo "sprinkle: setting up warp ..."
  260.         WARPDIR=/usr/games/lib/warp
  261.         export WARPDIR
  262.         cd $mntpt/games/lib/warp
  263.         [ -d $WARPDIR ] || mkdir -p $WARPDIR
  264.         find . -depth -print | cpio -pdm $WARPDIR > /dev/null 2>&1
  265.         cp $mntpt/bin/warp.real /usr/games/warp
  266.         chown 9999 /usr/games/warp
  267.         chmod 4755 /usr/games/warp
  268.         cd /usr/games/lib/warp
  269.         find . -print | xargs chown 9999
  270.         ;;
  271.     seyon*) 
  272.         echo "sprinkle: setting up seyon ..."
  273.         setuucp seyon
  274.         ;;
  275.     xc*) 
  276.         echo "sprinkle: setting up xc ..."
  277.         setuucp xc
  278.         ;;
  279.     "") break
  280.         ;;
  281.     *)
  282.         for i in X11 Tools Games
  283.         do
  284.             [ -d $mntpt/$i/$cmpnt ] && {
  285.                 echo "In order to install $cmpnt, you can copy the source"
  286.                 echo "directory $mntpt/$i/$cmpnt to your hard disk and follow"
  287.                 echo "the build and install instructions for this component."
  288.                 foundit=1
  289.             }
  290.         done
  291.         [ "$foundit" ] || echo "Unrecognized component : $cmpnt"
  292.         ;;
  293.     esac
  294. do
  295.     shift
  296.     cmpnt=$1
  297. done
  298.